#include "system.h"

void initPins()
{

	//Set Analog/Digital Pins as Digital
	_PCFG4  = 1;
	_PCFG5  = 1;
	_PCFG6  = 1;
	_PCFG7  = 1;
	_PCFG8  = 1;
	_PCFG10 = 1;
	_PCFG11 = 1;
	_PCFG12 = 1;

	//Set Pins as Digital Output
	_TRISA0  = 0;
	_TRISB4  = 0;
	_TRISB5  = 0;
	_TRISB6  = 0;
	_TRISB7  = 0;
	_TRISB9  = 0;
	_TRISB11 = 0;
	_TRISB12 = 0;
	_TRISB15 = 0;
	_TRISC0  = 0;
	_TRISC1  = 0;

	//Set Pins as Digital Input
	_TRISB2 = 1;
	_TRISB3 = 1;
	_TRISB8 = 1;


	//Set UART Pins
#ifdef RS485
	_RP13R =  3;	//Uart Transmit Page 101 and 102 Data Sheet (Pin 11) (Output)
	_U1RXR = 14;	//Uart Recieve Page 102 Data Sheet (Pin 14) (Input)
#endif

#ifdef RS232
	_RP19R = 3;
	_U1RXR = 20;
#endif

	//Set UART2 Pins
	//_RP20R =  5;	//Uart Transmit Page 101 and 102 Data Sheet (Chip Pin 37)(Expanstion Pin 6) (Output)
	_U2RXR = 21;	//Uart Recieve Page 102 Data Sheet (Chip Pin 38)(Expanstion Pin 8) (Input)
}

